package com.example.camerastudy.slice;

import com.example.camerastudy.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;

public class MainAbilitySlice extends AbilitySlice {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        findComponentById(ResourceTable.Id_button_camera).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                present(new CameraSlice(),new Intent());
            }
        });

        findComponentById(ResourceTable.Id_button_record).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                present(new RecordSlice(),new Intent());
            }
        });

        findComponentById(ResourceTable.Id_button_audio).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                present(new AudioSlice(),new Intent());
            }
        });

        findComponentById(ResourceTable.Id_button_sound).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                present(new SoundSlice(),new Intent());
            }
        });
    }
}
